package com.by.web;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * https://blog.csdn.net/eumenides_/article/details/79033505
 *
 * https://www.cnblogs.com/snowstorm/p/8073389.html
 *
 * https://www.cnblogs.com/page12/p/8166935.html
 */
public class BaseController {
    @InitBinder
    public void initBinder(ServletRequestDataBinder binder) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));
    }
}
